/**
 * 示例控制器
 */
class mainUIController extends Frame.MVC.Controller {
    view: mainUIView;
    constructor() {
        super();
        Frame.Message.addListener("1", this.testListener, this);
    }
    private testListener(...param) {
        Frame.debugConsole(this, ...param);
    }

    viewInit() {
        this.view.startBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.startBtn, this);
        this.startBtnTween();
    }

    private startBtn($evt) {
        Frame.Message.dispatch("1", 4, 57, 8);
        if (typeof (<any>window).sdk !== 'undefined' && (<any>window).sdk.showBanner !== 'undefined') {
            (<any>window).sdk.showBanner();
        }
        Frame.debugConsole(this, "开始游戏", $evt);
        Frame.Game.runScene(SceneKey.game);
    }

    private startBtnTween() {
        egret.Tween.get(this.view.startBtn).to({
            scaleX: 1.1,
            scaleY: 1.1,
        }, 1000).to({
            scaleX: 1,
            scaleY: 1

        }, 1000).call(() => {
            this.startBtnTween();
        }, this);
    }

}